/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.empresa.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Rolando
 */
@Entity
@Table(name = "cliente", catalog = "trabajo", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"),
    @NamedQuery(name = "Cliente.findByIdCliente", query = "SELECT c FROM Cliente c WHERE c.idCliente = :idCliente"),
    @NamedQuery(name = "Cliente.findByCp", query = "SELECT c FROM Cliente c WHERE c.cp = :cp"),
    @NamedQuery(name = "Cliente.findByDepartamento", query = "SELECT c FROM Cliente c WHERE c.departamento = :departamento"),
    @NamedQuery(name = "Cliente.findByDireccion", query = "SELECT c FROM Cliente c WHERE c.direccion = :direccion"),
    @NamedQuery(name = "Cliente.findByDistrito", query = "SELECT c FROM Cliente c WHERE c.distrito = :distrito"),
    @NamedQuery(name = "Cliente.findByEmail", query = "SELECT c FROM Cliente c WHERE c.email = :email"),
    @NamedQuery(name = "Cliente.findByNombre", query = "SELECT c FROM Cliente c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Cliente.findByNombrec", query = "SELECT c FROM Cliente c WHERE c.nombrec = :nombrec"),
    @NamedQuery(name = "Cliente.findByProvincia", query = "SELECT c FROM Cliente c WHERE c.provincia = :provincia"),
    @NamedQuery(name = "Cliente.findByTelf1", query = "SELECT c FROM Cliente c WHERE c.telf1 = :telf1"),
    @NamedQuery(name = "Cliente.findByTelf2", query = "SELECT c FROM Cliente c WHERE c.telf2 = :telf2"),
    @NamedQuery(name = "Cliente.findByTelf3", query = "SELECT c FROM Cliente c WHERE c.telf3 = :telf3")})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_cliente", nullable = false, length = 5)
    private String idCliente;
    @Basic(optional = false)
    @Column(name = "cp", nullable = false, length = 15)
    private String cp;
    @Basic(optional = false)
    @Column(name = "departamento", nullable = false, length = 30)
    private String departamento;
    @Basic(optional = false)
    @Column(name = "direccion", nullable = false, length = 30)
    private String direccion;
    @Basic(optional = false)
    @Column(name = "distrito", nullable = false, length = 30)
    private String distrito;
    @Basic(optional = false)
    @Column(name = "email", nullable = false, length = 20)
    private String email;
    @Basic(optional = false)
    @Column(name = "nombre", nullable = false, length = 60)
    private String nombre;
    @Basic(optional = false)
    @Column(name = "nombrec", nullable = false, length = 60)
    private String nombrec;
    @Basic(optional = false)
    @Column(name = "provincia", nullable = false, length = 30)
    private String provincia;
    @Basic(optional = false)
    @Column(name = "telf1", nullable = false, length = 12)
    private String telf1;
    @Basic(optional = false)
    @Column(name = "telf2", nullable = false, length = 12)
    private String telf2;
    @Basic(optional = false)
    @Column(name = "telf3", nullable = false, length = 12)
    private String telf3;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente")
    private List<Ventas> ventasList;

    public Cliente() {
    }

    public Cliente(String idCliente) {
        this.idCliente = idCliente;
    }

    public Cliente(String idCliente, String cp, String departamento, String direccion, String distrito, String email, String nombre, String nombrec, String provincia, String telf1, String telf2, String telf3) {
        this.idCliente = idCliente;
        this.cp = cp;
        this.departamento = departamento;
        this.direccion = direccion;
        this.distrito = distrito;
        this.email = email;
        this.nombre = nombre;
        this.nombrec = nombrec;
        this.provincia = provincia;
        this.telf1 = telf1;
        this.telf2 = telf2;
        this.telf3 = telf3;
    }

    public String getIdCliente() {
        return idCliente;
    }

    public void setIdCliente(String idCliente) {
        this.idCliente = idCliente;
    }

    public String getCp() {
        return cp;
    }

    public void setCp(String cp) {
        this.cp = cp;
    }

    public String getDepartamento() {
        return departamento;
    }

    public void setDepartamento(String departamento) {
        this.departamento = departamento;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getDistrito() {
        return distrito;
    }

    public void setDistrito(String distrito) {
        this.distrito = distrito;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getNombrec() {
        return nombrec;
    }

    public void setNombrec(String nombrec) {
        this.nombrec = nombrec;
    }

    public String getProvincia() {
        return provincia;
    }

    public void setProvincia(String provincia) {
        this.provincia = provincia;
    }

    public String getTelf1() {
        return telf1;
    }

    public void setTelf1(String telf1) {
        this.telf1 = telf1;
    }

    public String getTelf2() {
        return telf2;
    }

    public void setTelf2(String telf2) {
        this.telf2 = telf2;
    }

    public String getTelf3() {
        return telf3;
    }

    public void setTelf3(String telf3) {
        this.telf3 = telf3;
    }

    @XmlTransient
    public List<Ventas> getVentasList() {
        return ventasList;
    }

    public void setVentasList(List<Ventas> ventasList) {
        this.ventasList = ventasList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCliente != null ? idCliente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.idCliente == null && other.idCliente != null) || (this.idCliente != null && !this.idCliente.equals(other.idCliente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.empresa.entidades.Cliente[ idCliente=" + idCliente + " ]";
    }
    
}
